
-- --------------------------------------------------
-- Entity Designer DDL Script for SQL Server 2005, 2008, 2012 and Azure
-- --------------------------------------------------
-- Date Created: 07/08/2014 23:50:07
-- Generated from EDMX file: E:\MVC\WEb_DH\ADShop\ADShop\ADShop\Models\ADShop.edmx
-- --------------------------------------------------

SET QUOTED_IDENTIFIER OFF;
GO
USE [EShop];
GO
IF SCHEMA_ID(N'dbo') IS NULL EXECUTE(N'CREATE SCHEMA [dbo]');
GO

-- --------------------------------------------------
-- Dropping existing FOREIGN KEY constraints
-- --------------------------------------------------

IF OBJECT_ID(N'[dbo].[FK_ImagesProduct_Product]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[ImagesProduct] DROP CONSTRAINT [FK_ImagesProduct_Product];
GO
IF OBJECT_ID(N'[dbo].[FK_InfoMember_Member]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[InfoMember] DROP CONSTRAINT [FK_InfoMember_Member];
GO
IF OBJECT_ID(N'[dbo].[FK_OrderProduct_Member]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[OrderProduct] DROP CONSTRAINT [FK_OrderProduct_Member];
GO
IF OBJECT_ID(N'[dbo].[FK_OrderProduct_PaymentMethod]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[OrderProduct] DROP CONSTRAINT [FK_OrderProduct_PaymentMethod];
GO
IF OBJECT_ID(N'[dbo].[FK_OrderProduct_Product]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[OrderProduct] DROP CONSTRAINT [FK_OrderProduct_Product];
GO
IF OBJECT_ID(N'[dbo].[FK_OrderProduct_ShipMethod]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[OrderProduct] DROP CONSTRAINT [FK_OrderProduct_ShipMethod];
GO
IF OBJECT_ID(N'[dbo].[FK_Product_Brank]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Product] DROP CONSTRAINT [FK_Product_Brank];
GO
IF OBJECT_ID(N'[dbo].[FK_Product_Category]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Product] DROP CONSTRAINT [FK_Product_Category];
GO
IF OBJECT_ID(N'[dbo].[FK_Product_Promotions]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Product] DROP CONSTRAINT [FK_Product_Promotions];
GO
IF OBJECT_ID(N'[dbo].[FK_Product_StatusProduct]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Product] DROP CONSTRAINT [FK_Product_StatusProduct];
GO
IF OBJECT_ID(N'[dbo].[FK_RatingProduct_Product]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[RatingProduct] DROP CONSTRAINT [FK_RatingProduct_Product];
GO
IF OBJECT_ID(N'[dbo].[FK_RewardsUser_Member]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[RewardsUser] DROP CONSTRAINT [FK_RewardsUser_Member];
GO

-- --------------------------------------------------
-- Dropping existing tables
-- --------------------------------------------------

IF OBJECT_ID(N'[dbo].[AdvCompany]', 'U') IS NOT NULL
    DROP TABLE [dbo].[AdvCompany];
GO
IF OBJECT_ID(N'[dbo].[Brand]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Brand];
GO
IF OBJECT_ID(N'[dbo].[Category]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Category];
GO
IF OBJECT_ID(N'[dbo].[EmailNewsletters]', 'U') IS NOT NULL
    DROP TABLE [dbo].[EmailNewsletters];
GO
IF OBJECT_ID(N'[dbo].[ImagesProduct]', 'U') IS NOT NULL
    DROP TABLE [dbo].[ImagesProduct];
GO
IF OBJECT_ID(N'[dbo].[InfoMember]', 'U') IS NOT NULL
    DROP TABLE [dbo].[InfoMember];
GO
IF OBJECT_ID(N'[dbo].[Member]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Member];
GO
IF OBJECT_ID(N'[dbo].[OrderProduct]', 'U') IS NOT NULL
    DROP TABLE [dbo].[OrderProduct];
GO
IF OBJECT_ID(N'[dbo].[PaymentMethod]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PaymentMethod];
GO
IF OBJECT_ID(N'[dbo].[Privilege]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Privilege];
GO
IF OBJECT_ID(N'[dbo].[Product]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Product];
GO
IF OBJECT_ID(N'[dbo].[PromotionsProduct]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PromotionsProduct];
GO
IF OBJECT_ID(N'[dbo].[RatingProduct]', 'U') IS NOT NULL
    DROP TABLE [dbo].[RatingProduct];
GO
IF OBJECT_ID(N'[dbo].[RewardsUser]', 'U') IS NOT NULL
    DROP TABLE [dbo].[RewardsUser];
GO
IF OBJECT_ID(N'[dbo].[ShipMethod]', 'U') IS NOT NULL
    DROP TABLE [dbo].[ShipMethod];
GO
IF OBJECT_ID(N'[dbo].[Slider]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Slider];
GO
IF OBJECT_ID(N'[dbo].[StatusProduct]', 'U') IS NOT NULL
    DROP TABLE [dbo].[StatusProduct];
GO
IF OBJECT_ID(N'[dbo].[sysdiagrams]', 'U') IS NOT NULL
    DROP TABLE [dbo].[sysdiagrams];
GO
IF OBJECT_ID(N'[dbo].[VoucherProduct]', 'U') IS NOT NULL
    DROP TABLE [dbo].[VoucherProduct];
GO

-- --------------------------------------------------
-- Creating all tables
-- --------------------------------------------------

-- Creating table 'AdvCompany'
CREATE TABLE [dbo].[AdvCompany] (
    [IDAdv] int IDENTITY(1,1) NOT NULL,
    [NameAdv] nvarchar(200)  NULL,
    [CompanyAdv] nvarchar(200)  NULL,
    [DescriptionAdv] nvarchar(max)  NULL,
    [LinkAdv] nvarchar(50)  NULL,
    [PercentAdv] int  NULL,
    [Details] nvarchar(max)  NULL,
    [FromDay] datetime  NULL,
    [ToDay] datetime  NULL,
    [PriceAdv] bigint  NULL,
    [Active] bit  NULL
);
GO

-- Creating table 'Brand'
CREATE TABLE [dbo].[Brand] (
    [IDBrand] int IDENTITY(1,1) NOT NULL,
    [BrandName] nvarchar(50)  NULL,
    [BrandDetails] nvarchar(max)  NULL,
    [Active] bit  NULL
);
GO

-- Creating table 'Category'
CREATE TABLE [dbo].[Category] (
    [IDCategory] int IDENTITY(1,1) NOT NULL,
    [ParentIDCategory] int  NULL,
    [NameCategory] nvarchar(200)  NULL,
    [Details] nvarchar(max)  NULL,
    [Active] bit  NULL
);
GO

-- Creating table 'EmailNewsletters'
CREATE TABLE [dbo].[EmailNewsletters] (
    [IDEmailNewsletters] int IDENTITY(1,1) NOT NULL,
    [NameEmail] nvarchar(100)  NULL,
    [Active] bit  NULL
);
GO

-- Creating table 'ImagesProduct'
CREATE TABLE [dbo].[ImagesProduct] (
    [IDImagesProduct] int IDENTITY(1,1) NOT NULL,
    [IDProduct] int  NOT NULL,
    [LinkImagesProduct] nvarchar(max)  NULL,
    [DescriptionImages] nvarchar(200)  NULL,
    [Active] bit  NULL
);
GO

-- Creating table 'InfoMember'
CREATE TABLE [dbo].[InfoMember] (
    [UserID] int  NOT NULL,
    [FirstName] nvarchar(50)  NULL,
    [LastName] nvarchar(50)  NULL,
    [Fax] nvarchar(50)  NULL,
    [NumberPhone] nvarchar(50)  NULL,
    [NumberCardMember] nvarchar(50)  NULL,
    [Company] nvarchar(200)  NULL,
    [Representative] nvarchar(200)  NULL,
    [TaxCode] nvarchar(50)  NULL,
    [Address] nvarchar(500)  NULL
);
GO

-- Creating table 'Member'
CREATE TABLE [dbo].[Member] (
    [IDUser] int IDENTITY(1,1) NOT NULL,
    [UserEmail] nvarchar(50)  NOT NULL,
    [Password] nvarchar(50)  NULL,
    [IDPrivilege] int  NULL,
    [Active] bit  NULL
);
GO

-- Creating table 'OrderProduct'
CREATE TABLE [dbo].[OrderProduct] (
    [IDOrder] int IDENTITY(1,1) NOT NULL,
    [IDShipMethod] int  NULL,
    [IDPaymentMethod] int  NULL,
    [IDUser] int  NULL,
    [IDProduct] int  NULL,
    [Quantity] nchar(10)  NULL,
    [TotalPrice] decimal(18,0)  NULL,
    [Recipient] nvarchar(200)  NULL,
    [AddressRecipient] nvarchar(200)  NULL,
    [EmailRecipient] nvarchar(50)  NULL,
    [PhoneRecipient] nvarchar(15)  NULL,
    [Messenger] nvarchar(max)  NULL,
    [Active] bit  NULL
);
GO

-- Creating table 'PaymentMethod'
CREATE TABLE [dbo].[PaymentMethod] (
    [IDPaymentMethod] int IDENTITY(1,1) NOT NULL,
    [NamePaymentMethod] nvarchar(50)  NULL,
    [Details] nvarchar(max)  NULL,
    [Active] nchar(10)  NULL
);
GO

-- Creating table 'Privilege'
CREATE TABLE [dbo].[Privilege] (
    [IDPrivilege] int IDENTITY(1,1) NOT NULL,
    [NamePrivilege] nvarchar(50)  NULL,
    [Details] nvarchar(max)  NULL,
    [Active] bit  NULL
);
GO

-- Creating table 'Product'
CREATE TABLE [dbo].[Product] (
    [IDProduct] int IDENTITY(1,1) NOT NULL,
    [IDStatus] int  NULL,
    [IDCategory] int  NULL,
    [IDPromotions] int  NULL,
    [IDBrand] int  NULL,
    [NameProduct] nvarchar(200)  NULL,
    [Description] nvarchar(max)  NULL,
    [TrialDay] int  NULL,
    [ListedPrice] decimal(18,0)  NOT NULL,
    [PriceProduct] decimal(18,0)  NOT NULL,
    [Rewards] int  NOT NULL,
    [ProductImage] nvarchar(max)  NULL,
    [View] int  NULL,
    [Active] bit  NOT NULL
);
GO

-- Creating table 'PromotionsProduct'
CREATE TABLE [dbo].[PromotionsProduct] (
    [IDPromotions] int IDENTITY(1,1) NOT NULL,
    [IDProduct] int  NULL,
    [FromDay] datetime  NULL,
    [ToDay] datetime  NULL,
    [Quantity] int  NULL,
    [Active] bit  NULL
);
GO

-- Creating table 'RatingProduct'
CREATE TABLE [dbo].[RatingProduct] (
    [IDRating] int IDENTITY(1,1) NOT NULL,
    [IDProduct] int  NOT NULL,
    [IDUser] int  NOT NULL,
    [Score] int  NULL,
    [Details] nvarchar(max)  NULL,
    [Active] bit  NULL
);
GO

-- Creating table 'RewardsUser'
CREATE TABLE [dbo].[RewardsUser] (
    [IDUser] int  NOT NULL,
    [Rewards] bigint  NULL,
    [Active] bit  NULL
);
GO

-- Creating table 'ShipMethod'
CREATE TABLE [dbo].[ShipMethod] (
    [IDShipMethod] int IDENTITY(1,1) NOT NULL,
    [NameShipMethod] nvarchar(50)  NULL,
    [Active] bit  NULL
);
GO

-- Creating table 'Slider'
CREATE TABLE [dbo].[Slider] (
    [IDSlider] int IDENTITY(1,1) NOT NULL,
    [SliderText] nvarchar(200)  NULL,
    [SliderImage] nvarchar(max)  NULL,
    [Active] bit  NULL
);
GO

-- Creating table 'StatusProduct'
CREATE TABLE [dbo].[StatusProduct] (
    [IDStatus] int IDENTITY(1,1) NOT NULL,
    [NameStatus] nvarchar(50)  NULL,
    [Details] nvarchar(max)  NULL,
    [Active] bit  NULL
);
GO

-- Creating table 'sysdiagrams'
CREATE TABLE [dbo].[sysdiagrams] (
    [name] nvarchar(128)  NOT NULL,
    [principal_id] int  NOT NULL,
    [diagram_id] int IDENTITY(1,1) NOT NULL,
    [version] int  NULL,
    [definition] varbinary(max)  NULL
);
GO

-- Creating table 'VoucherProduct'
CREATE TABLE [dbo].[VoucherProduct] (
    [IDVoucherCode] int IDENTITY(1,1) NOT NULL,
    [VoucherCode] nvarchar(50)  NULL,
    [Discounts] int  NULL,
    [Active] bit  NULL
);
GO

-- --------------------------------------------------
-- Creating all PRIMARY KEY constraints
-- --------------------------------------------------

-- Creating primary key on [IDAdv] in table 'AdvCompany'
ALTER TABLE [dbo].[AdvCompany]
ADD CONSTRAINT [PK_AdvCompany]
    PRIMARY KEY CLUSTERED ([IDAdv] ASC);
GO

-- Creating primary key on [IDBrand] in table 'Brand'
ALTER TABLE [dbo].[Brand]
ADD CONSTRAINT [PK_Brand]
    PRIMARY KEY CLUSTERED ([IDBrand] ASC);
GO

-- Creating primary key on [IDCategory] in table 'Category'
ALTER TABLE [dbo].[Category]
ADD CONSTRAINT [PK_Category]
    PRIMARY KEY CLUSTERED ([IDCategory] ASC);
GO

-- Creating primary key on [IDEmailNewsletters] in table 'EmailNewsletters'
ALTER TABLE [dbo].[EmailNewsletters]
ADD CONSTRAINT [PK_EmailNewsletters]
    PRIMARY KEY CLUSTERED ([IDEmailNewsletters] ASC);
GO

-- Creating primary key on [IDImagesProduct], [IDProduct] in table 'ImagesProduct'
ALTER TABLE [dbo].[ImagesProduct]
ADD CONSTRAINT [PK_ImagesProduct]
    PRIMARY KEY CLUSTERED ([IDImagesProduct], [IDProduct] ASC);
GO

-- Creating primary key on [UserID] in table 'InfoMember'
ALTER TABLE [dbo].[InfoMember]
ADD CONSTRAINT [PK_InfoMember]
    PRIMARY KEY CLUSTERED ([UserID] ASC);
GO

-- Creating primary key on [IDUser] in table 'Member'
ALTER TABLE [dbo].[Member]
ADD CONSTRAINT [PK_Member]
    PRIMARY KEY CLUSTERED ([IDUser] ASC);
GO

-- Creating primary key on [IDOrder] in table 'OrderProduct'
ALTER TABLE [dbo].[OrderProduct]
ADD CONSTRAINT [PK_OrderProduct]
    PRIMARY KEY CLUSTERED ([IDOrder] ASC);
GO

-- Creating primary key on [IDPaymentMethod] in table 'PaymentMethod'
ALTER TABLE [dbo].[PaymentMethod]
ADD CONSTRAINT [PK_PaymentMethod]
    PRIMARY KEY CLUSTERED ([IDPaymentMethod] ASC);
GO

-- Creating primary key on [IDPrivilege] in table 'Privilege'
ALTER TABLE [dbo].[Privilege]
ADD CONSTRAINT [PK_Privilege]
    PRIMARY KEY CLUSTERED ([IDPrivilege] ASC);
GO

-- Creating primary key on [IDProduct] in table 'Product'
ALTER TABLE [dbo].[Product]
ADD CONSTRAINT [PK_Product]
    PRIMARY KEY CLUSTERED ([IDProduct] ASC);
GO

-- Creating primary key on [IDPromotions] in table 'PromotionsProduct'
ALTER TABLE [dbo].[PromotionsProduct]
ADD CONSTRAINT [PK_PromotionsProduct]
    PRIMARY KEY CLUSTERED ([IDPromotions] ASC);
GO

-- Creating primary key on [IDRating], [IDProduct] in table 'RatingProduct'
ALTER TABLE [dbo].[RatingProduct]
ADD CONSTRAINT [PK_RatingProduct]
    PRIMARY KEY CLUSTERED ([IDRating], [IDProduct] ASC);
GO

-- Creating primary key on [IDUser] in table 'RewardsUser'
ALTER TABLE [dbo].[RewardsUser]
ADD CONSTRAINT [PK_RewardsUser]
    PRIMARY KEY CLUSTERED ([IDUser] ASC);
GO

-- Creating primary key on [IDShipMethod] in table 'ShipMethod'
ALTER TABLE [dbo].[ShipMethod]
ADD CONSTRAINT [PK_ShipMethod]
    PRIMARY KEY CLUSTERED ([IDShipMethod] ASC);
GO

-- Creating primary key on [IDSlider] in table 'Slider'
ALTER TABLE [dbo].[Slider]
ADD CONSTRAINT [PK_Slider]
    PRIMARY KEY CLUSTERED ([IDSlider] ASC);
GO

-- Creating primary key on [IDStatus] in table 'StatusProduct'
ALTER TABLE [dbo].[StatusProduct]
ADD CONSTRAINT [PK_StatusProduct]
    PRIMARY KEY CLUSTERED ([IDStatus] ASC);
GO

-- Creating primary key on [diagram_id] in table 'sysdiagrams'
ALTER TABLE [dbo].[sysdiagrams]
ADD CONSTRAINT [PK_sysdiagrams]
    PRIMARY KEY CLUSTERED ([diagram_id] ASC);
GO

-- Creating primary key on [IDVoucherCode] in table 'VoucherProduct'
ALTER TABLE [dbo].[VoucherProduct]
ADD CONSTRAINT [PK_VoucherProduct]
    PRIMARY KEY CLUSTERED ([IDVoucherCode] ASC);
GO

-- --------------------------------------------------
-- Creating all FOREIGN KEY constraints
-- --------------------------------------------------

-- Creating foreign key on [IDBrand] in table 'Product'
ALTER TABLE [dbo].[Product]
ADD CONSTRAINT [FK_Product_Brank]
    FOREIGN KEY ([IDBrand])
    REFERENCES [dbo].[Brand]
        ([IDBrand])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_Product_Brank'
CREATE INDEX [IX_FK_Product_Brank]
ON [dbo].[Product]
    ([IDBrand]);
GO

-- Creating foreign key on [IDCategory] in table 'Product'
ALTER TABLE [dbo].[Product]
ADD CONSTRAINT [FK_Product_Category]
    FOREIGN KEY ([IDCategory])
    REFERENCES [dbo].[Category]
        ([IDCategory])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_Product_Category'
CREATE INDEX [IX_FK_Product_Category]
ON [dbo].[Product]
    ([IDCategory]);
GO

-- Creating foreign key on [IDProduct] in table 'ImagesProduct'
ALTER TABLE [dbo].[ImagesProduct]
ADD CONSTRAINT [FK_ImagesProduct_Product]
    FOREIGN KEY ([IDProduct])
    REFERENCES [dbo].[Product]
        ([IDProduct])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_ImagesProduct_Product'
CREATE INDEX [IX_FK_ImagesProduct_Product]
ON [dbo].[ImagesProduct]
    ([IDProduct]);
GO

-- Creating foreign key on [UserID] in table 'InfoMember'
ALTER TABLE [dbo].[InfoMember]
ADD CONSTRAINT [FK_InfoMember_Member]
    FOREIGN KEY ([UserID])
    REFERENCES [dbo].[Member]
        ([IDUser])
    ON DELETE NO ACTION ON UPDATE NO ACTION;
GO

-- Creating foreign key on [IDUser] in table 'OrderProduct'
ALTER TABLE [dbo].[OrderProduct]
ADD CONSTRAINT [FK_OrderProduct_Member]
    FOREIGN KEY ([IDUser])
    REFERENCES [dbo].[Member]
        ([IDUser])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_OrderProduct_Member'
CREATE INDEX [IX_FK_OrderProduct_Member]
ON [dbo].[OrderProduct]
    ([IDUser]);
GO

-- Creating foreign key on [IDUser] in table 'RewardsUser'
ALTER TABLE [dbo].[RewardsUser]
ADD CONSTRAINT [FK_RewardsUser_Member]
    FOREIGN KEY ([IDUser])
    REFERENCES [dbo].[Member]
        ([IDUser])
    ON DELETE NO ACTION ON UPDATE NO ACTION;
GO

-- Creating foreign key on [IDPaymentMethod] in table 'OrderProduct'
ALTER TABLE [dbo].[OrderProduct]
ADD CONSTRAINT [FK_OrderProduct_PaymentMethod]
    FOREIGN KEY ([IDPaymentMethod])
    REFERENCES [dbo].[PaymentMethod]
        ([IDPaymentMethod])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_OrderProduct_PaymentMethod'
CREATE INDEX [IX_FK_OrderProduct_PaymentMethod]
ON [dbo].[OrderProduct]
    ([IDPaymentMethod]);
GO

-- Creating foreign key on [IDProduct] in table 'OrderProduct'
ALTER TABLE [dbo].[OrderProduct]
ADD CONSTRAINT [FK_OrderProduct_Product]
    FOREIGN KEY ([IDProduct])
    REFERENCES [dbo].[Product]
        ([IDProduct])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_OrderProduct_Product'
CREATE INDEX [IX_FK_OrderProduct_Product]
ON [dbo].[OrderProduct]
    ([IDProduct]);
GO

-- Creating foreign key on [IDShipMethod] in table 'OrderProduct'
ALTER TABLE [dbo].[OrderProduct]
ADD CONSTRAINT [FK_OrderProduct_ShipMethod]
    FOREIGN KEY ([IDShipMethod])
    REFERENCES [dbo].[ShipMethod]
        ([IDShipMethod])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_OrderProduct_ShipMethod'
CREATE INDEX [IX_FK_OrderProduct_ShipMethod]
ON [dbo].[OrderProduct]
    ([IDShipMethod]);
GO

-- Creating foreign key on [IDPromotions] in table 'Product'
ALTER TABLE [dbo].[Product]
ADD CONSTRAINT [FK_Product_Promotions]
    FOREIGN KEY ([IDPromotions])
    REFERENCES [dbo].[PromotionsProduct]
        ([IDPromotions])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_Product_Promotions'
CREATE INDEX [IX_FK_Product_Promotions]
ON [dbo].[Product]
    ([IDPromotions]);
GO

-- Creating foreign key on [IDStatus] in table 'Product'
ALTER TABLE [dbo].[Product]
ADD CONSTRAINT [FK_Product_StatusProduct]
    FOREIGN KEY ([IDStatus])
    REFERENCES [dbo].[StatusProduct]
        ([IDStatus])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_Product_StatusProduct'
CREATE INDEX [IX_FK_Product_StatusProduct]
ON [dbo].[Product]
    ([IDStatus]);
GO

-- Creating foreign key on [IDProduct] in table 'RatingProduct'
ALTER TABLE [dbo].[RatingProduct]
ADD CONSTRAINT [FK_RatingProduct_Product]
    FOREIGN KEY ([IDProduct])
    REFERENCES [dbo].[Product]
        ([IDProduct])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_RatingProduct_Product'
CREATE INDEX [IX_FK_RatingProduct_Product]
ON [dbo].[RatingProduct]
    ([IDProduct]);
GO

-- --------------------------------------------------
-- Script has ended
-- --------------------------------------------------